home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / math / differ.zip / DIFFER.H < prev    next >
C/C++ Source or Header  |  1996-02-11  |  1KB  |  37 lines

  1. #include <math.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <ctype.h>
  5. #include <string.h>
  6. #include <stdlib.h>
  7. #include "genlib.h"
  8.  
  9. #define MAXINPLINELEN 200
  10.  
  11. typedef enum {VALUE=1,CONSTANT,X,FUNCTION,OPERATOR,UNDEF_ETYPE} etype;
  12. typedef enum {PLUS=1,MINUS,TIMES,DIVIDE,UMINUS,POWER,BRACKET,UNDEF_OP} operators;
  13. typedef enum {SIN=1,COS,EXP,LN,TAN,SEC,COSEC,COT,SINH,COSH,TANH,SECH,
  14.           COSECH,COTH,ARCSINH,ARCSIN,ARCCOSH,ARCCOS,ARCTANH,ARCTAN,
  15.           UNDEF_FUNC} functions;
  16. typedef char constants;
  17.  
  18. struct expression
  19. { etype exptype;
  20.   union
  21.   { operators op;
  22.     functions fn;
  23.     constants co;
  24.   } expval;
  25.   float cval;
  26.   struct expression *rval;
  27.   struct expression *lval;
  28. };
  29.  
  30. struct expression *differentiate(struct expression *expr);
  31. struct expression *parser(char *buff);
  32. struct expression *simplify(struct expression *expr);
  33. void printout(struct expression *expr);
  34. void freetree(struct expression *expr);
  35. struct expression *newtree(void);
  36. struct expression *copytree(struct expression *expr);
  37.